# coding=utf-8
from appium import webdriver
import unittest
import time

from PO.BasePage import Base
from PO.DiscoverPage import DiscoverPage
from PO.IndexPage import IndexPage


class TestDiscover(unittest.TestCase):
    """测试发现页面"""

    def setUp(self):
        capabilities = {
            'platformName': 'Android',
            'platformVersion': '4.4.2',
            'deviceName': '127.0.0.1:62001',
            'appPackage': 'com.guokr.mentor',
            'appActivity': '.ui.activity.MainActivity',
            'unicodeKeyboard': True,
            'resetKeyboard': True,
            'noReset': True
        }
        self.driver = webdriver.Remote("http://localhost:4723/wd/hub", capabilities)
        self.mydis = DiscoverPage(self.driver)
        self.myindex = IndexPage(self.driver)

    def tearDown(self):
        self.driver.quit()

    # def test14(self):
    #     """好评列表中的信息存在立即预约按钮"""
    #     # self.myindex.discover_page()
    #     # time.sleep(2)
    #     self.mydis.discover_page()
    #     self.mydis.praise()
    #     time.sleep(2)
    #     self.mydis.listFirst()
    #     time.sleep(2)
    #     self.assertEqual(self.mydis.order(), "立即预约")
    def test10(self):
        """新鲜列表中的信息存在立即预约按钮"""
        time.sleep(5)
        self.mydis.discover_page()
        self.mydis.fresh()
        time.sleep(2)
        self.mydis.listFirst()
        time.sleep(2)
        self.assertEqual(self.mydis.order(), "立即预约")


